# -*- coding:utf-8 -*-
'''
@author: xiaoming
@contact: lishihui0129 @ 163.com
@time: 2017 / 6 / 26 14:46
@desc:
'''

import os

class FileOperation(object):
    def __init__(self,_dirNmae,_filenameMd5):
        self.dirName=_dirNmae
        self.middleName=_filenameMd5

    def fileCreate(self,fileName):
        targetName=self.dirName+"\\"+self.middleName+fileName+".txt"
        # 文件不存在，创建新文件
        fh=open(targetName,'a')
        return fh

    def fileClose(self,fh):
        if fh!=None:
            fh.close()
        else:
            pass
    @classmethod
    def removeFile(cls,filename):
        os.remove(filename)
